<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0,minimum-scale=1.0,maximum-scale=1.0" />
    <meta name="author" content="火星科技 http://mars3d.cn " />
    <meta name="apple-touch-fullscreen" content="yes" />
    <meta name="apple-mobile-web-app-capable" content="yes" />
    <meta name="apple-mobile-web-app-status-bar-style" content="black" />
    <meta name="format-detection" content="telephone=no" />
    <meta name="x5-fullscreen" content="true" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1" />
    <!-- 标题及搜索关键字 -->
    <meta name="keywords" content="火星科技,cesium,3D,GIS,marsgis,三维,地球,地图,开发,框架,系统,示例,资料,模型,离线,外包,合肥,安徽,中国" />
    <meta
      name="description"
      content="火星科技 合肥火星 合肥火星科技 合肥火星科技有限公司 leaflet leaflet框架 leaflet开发 cesium cesium开发 cesium框架 三维 地球 模型  gis marsgis 地图离线 地图开发 地图框架 地图外包 框架 开发 外包  地图离线 二维地图 三维地图 全景漫游 地理信息系统 云GIS 三维GIS GIS平台 WebGIS"
    />

    <link rel="shortcut icon" type="image/x-icon" href="/img/favicon/favicon.ico" />
    <title>3dtiles模型剖切(BIM) | Mars3D | 三维地图 | 火星科技 | 合肥火星科技有限公司</title>

    <!--第三方lib-->
    <script
      type="text/javascript"
      src="/lib/include-lib.js"
      libpath="/lib/"
      include="jquery,layer,toastr,font-awesome,bootstrap,bootstrap-checkbox,bootstrap-slider,layer,haoutil,mars3d"
    ></script>

    <link href="/css/style.css" rel="stylesheet" />
  </head>

  <body class="dark">


    <div id="mars3dContainer" class="mars3d-container"></div>

    <!-- 面板 -->
    <div class="infoview">
      <table class="mars-table">
        <tr>
          <td class="nametd"></td>
          <td colspan="2">
            <button id="btnDrawExtent" class="btn btn-primary">绘制Box</button>
            <button id="btnClear" class="btn btn-primary">清除</button>
          </td>
        </tr>

        <tr>
          <td>经度</td>
          <td>
            <input id="point_x" type="number" step="0.000001" value="117.251283" />
          </td>
        </tr>
        <tr>
          <td>纬度</td>
          <td>
            <input id="point_y" type="number" step="0.000001" value="31.843707" />
          </td>
        </tr>
        <tr>
          <td>高度</td>
          <td>
            <input id="point_z" type="number" step="0.1" value="43.7" />
          </td>
        </tr>

        <tr>
          <td class="nametd">盒子X长度</td>
          <td>
            <input id="dimensions_x" />
          </td>
        </tr>
        <tr>
          <td class="nametd">盒子Y长度</td>
          <td>
            <input id="dimensions_y" />
          </td>
        </tr>
        <tr>
          <td class="nametd">盒子Z长度</td>
          <td>
            <input id="dimensions_z" />
          </td>
        </tr>

        <tr>
          <td class="nametd">盒子</td>
          <td>
            <div class="checkbox checkbox-primary checkbox-inline">
              <input id="chkShowModelMatrix" class="styled" type="checkbox" checked />
              <label for="chkShowModelMatrix"> 显示/隐藏 </label>
            </div>
          </td>
        </tr>
      </table>
    </div>

    <script src="/js/common.js"></script>
    <script src="./map.js"></script>
    <script type="text/javascript">
      "use script" //开发环境建议开启严格模式

      function initUI(options) {
        eventTarget.on("hasDraw", (item) => {
          $("#point_x").val(item.point.lng)
          $("#point_y").val(item.point.lat)
          $("#point_z").val(item.point.alt)
        })

        //演示数据
        let point_x = Number($("#point_x").val())
        let point_y = Number($("#point_y").val())
        let point_z = Number($("#point_z").val())
        let point = [point_x, point_y, point_z]
        tilesetBoxClipDemo(point) // 添加演示数据

        // x、y、z值发生改变
        $("#dimensions_x")
          .slider({ min: 0, max: 100, step: 1, value: 20 })
          .on("change", (e) => {
            if (e && e.value) {
              onChangeDimensionsX(e.value.newValue)
            }
          })
        $("#dimensions_y")
          .slider({ min: 0, max: 100, step: 1, value: 10 })
          .on("change", (e) => {
            if (e && e.value) {
              onChangeDimensionsY(e.value.newValue)
            }
          })
        $("#dimensions_z")
          .slider({ min: 0, max: 100, step: 1, value: 15 })
          .on("change", (e) => {
            if (e && e.value) {
              onChangeDimensionsZ(e.value.newValue)
            }
          })

        // 坐标改变
        $("#point_x,#point_y,#point_z").change(function () {
          let point_x = Number($("#point_x").val())
          let point_y = Number($("#point_y").val())
          let point_z = Number($("#point_z").val())

          onChangePosition([point_x, point_y, point_z])
        })

        // 是否显示盒子
        $("#chkShowModelMatrix").change(function () {
          let val = $(this).is(":checked")
          showModelMatrix(val)
        })

        // 清除和绘制
        $("#btnClear").click(function () {
          clear()
        })
        $("#btnDrawExtent").click(function () {
          drawExtent()
        })
      }
    </script>
  </body>
</html>
